package java8;

import org.junit.Test;

import java.util.List;
import java.util.Optional;

/**
 * @author: zhenzhong.wang@honeywell.com
 * @date: 2019/6/22 7:11 PM
 */
public class OptionalTest {

  @Test
  public void test1() {
//    OptionEntity entity = new OptionEntity();
//    entity.setName("xiaoming");
    OptionEntity entity = null ;

    String name = Optional.ofNullable(entity)
        .map(e -> e.getName())
        .map(e -> e.toUpperCase())
        .orElse("123");
    System.out.println(name);
  }
}
